package domain.searchEngine;

import java.util.Date ;
import java.util.Set ;

import util.Statistics ;



/**
 * The Class SearchEngine functions like server between the domain layer and the persistence layer
 * responsible for finding all desirable data that the client wants.
 *
 * the search engine is responsible for closing the index.
 */
public interface SearchEngine
{
	/**
	 * shutdown the search engine.
	 */
	public void close() ;

	/**
	 * @return a per-hour post authoring statistics.
	 */
	public Statistics getPostStatistics() ;


	/**
	 * @param memberId id of the user for which statistics is requested.
	 * @return a 30-day backwards statistics on post authoring.
	 */
	public Statistics getPostStatisticsForMember(final long memberId) ;

	/**
	 * @return a per-hour user login statistics.
	 */
	public Statistics getUserStatistics() ;

	/**
	 * Search by author. searches for post id according to author username that the user typed.
	 * responsible for uploading all posts id
	 *
	 * @param authorName the username of the authors of the messages that the user wants
	 *
	 * @return the set< long> all desirable messages id
	 *

	 */
	public Set<SearchResult> searchByAuthor(String authorName);

	/**
	 * Search by content. searches for posts id according to content that the user wrote
	 * responsible for uploading all Posts id that contain the same words that the client asks
	 *
	 * @param message the message  that the user want to get messages according to
	 *
	 * @return set< long> all desirable messages

	 */
	public Set<SearchResult> searchByContent(String message);

	/**
	 * Search by date. searches for post according to range of dates
	 *
	 * @param fromDate the date from which the user wants the messages
	 * @param toDate the date to which the user wants the messages
	 *
	 * @return the set< long> all desirable messages id
	 *

	 */
	public Set<SearchResult> searchByDate(Date fromDate,Date toDate);

}
